/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.usuario.niceshot;

import br.com.niceshot.Conexao;
import br.com.pessoa.niceshot.PessoaQueries;
import static java.lang.System.out;
import java.sql.ResultSetMetaData;
import java.util.Date;

/**
 *
 * @author Alexandre
 */
public class UsuarioQueries extends PessoaQueries {

    public String checkLoginAvailable(String login) {
        try {
            con = Conexao.getConnection();
            stat = con.createStatement();
            rs = stat.executeQuery("SELECT id_usuario FROM usuario WHERE nm_usuario = " + login);

            if (rs.next()) {
                return rs.getString(1);
            }

        } catch (Exception e) {
            out.println(e.getMessage());

        } finally {
            try {
                rs.close();
            } catch (Exception e) {
            }
            try {
                con.close();
            } catch (Exception e) {
            }
            try {
                stat.close();
            } catch (Exception e) {
            }
        }

        return "";
    }

}
